('uuid', str),
('vcpus', int),
('vcpu_avail', int),
- ('cpu_weight', float),
+ ('cpu_cap', int),
+ ('cpu_weight', int),
('memory', int),
('shadow_memory', int),
('maxmem', int),
defaultInfo('features', lambda: "")
defaultInfo('cpu', lambda: None)
defaultInfo('cpus', lambda: [])
- defaultInfo('cpu_weight', lambda: 1.0)
+ defaultInfo('cpu_cap', lambda: 0)
+ defaultInfo('cpu_weight', lambda: 256)
# some domains don't have a config file (e.g. dom0 )
# to set number of vcpus so we derive available cpus
def getResume(self):
return "%s" % self.info['resume']
+ def getCap(self):
+ return self.info['cpu_cap']
+
+ def getWeight(self):
+ return self.info['cpu_weight']
+
def endRestore(self):
self.setResume(False)
fn=set_int, default=1,
use="# of Virtual CPUS in domain.")
+gopts.var('cpu_cap', val='CAP',
+ fn=set_int, default=None,
+ use="""Set the maximum amount of cpu.
+ CAP is a percentage that fixes the maximum amount of cpu.""")
+
gopts.var('cpu_weight', val='WEIGHT',
- fn=set_float, default=None,
- use="""Set the new domain's cpu weight.
- WEIGHT is a float that controls the domain's share of the cpu.""")
+ fn=set_int, default=None,
+ use="""Set the cpu time ratio to be allocated to the domain.""")
gopts.var('restart', val='onreboot|always|never',
fn=set_value, default=None,
config.append(['cpu', vals.cpu])
if vals.cpus is not None:
config.append(['cpus', vals.cpus])
+ if vals.cpu_cap is not None:
+ config.append(['cpu_cap', vals.cpu_cap])
if vals.cpu_weight is not None:
config.append(['cpu_weight', vals.cpu_weight])
if vals.blkif: